package ro.sergiu.finder.filters;

import javax.swing.JPanel;

/**
 *
 * @author Toporjinschi
 * @param <M> the type of verification item (ex. String if is a db connection, class if is a bean
 * search)
 * @param <V> type of value could (ex. String if the control is a text field and the referenced
 * column from db is also of type string)
 */
public abstract class FilterPanelUI<M, V> extends JPanel implements FilterField<M, V> {

    private String title;
    private final M mappingItem;
    private final Operator operator;

    public FilterPanelUI() {
        this("", null, null);
    }

    public FilterPanelUI(String title, M mappingItem, Operator operator) {
        this.title = title;
        this.mappingItem = mappingItem;
        this.operator = operator;
        initComponents();
    }

    @Override
    public M getMappingItem() {
        return mappingItem;
    }

    @Override
    public Operator getOperator() {
        return operator;
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT
     * modify this code. The content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setBorder(javax.swing.BorderFactory.createTitledBorder(this.title));
        setToolTipText("");
        setMaximumSize(new java.awt.Dimension(150, 45));
        setMinimumSize(new java.awt.Dimension(150, 45));
        setPreferredSize(new java.awt.Dimension(150, 45));
        setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
